package com.stars.controller.system;

import com.stars.common.annotation.Log;
import com.stars.common.annotation.UserMenuUpdateRedis;
import com.stars.common.base.BaseMsg;
import com.stars.common.base.ResultMsg;
import com.stars.common.enums.OperationType;
import com.stars.controller.BaseController;
import com.stars.services.system.SystemPerUserConfigServices;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: 资源与用户关系 mybatis dao
 * @author dj
 * @date 2019-10-17 20:57:38
 * @version V1.0
 *
 */
@Slf4j
@RestController
@RequestMapping("/systemPerUserCtl")
@Api(tags ="资源与用户关系")
public class SystemPerUserCtl extends BaseController{

   @Autowired
   private SystemPerUserConfigServices  systemPerUserConfigServicesImpl;
    /**
    * 保存
    * @param ids
    * @return 成功失败
    * @throws Exception
    */
    @PostMapping(value = "/add")
    @ApiOperation(value = "资源与用户关系"+ BaseMsg.MODULAR_ADD,notes = "资源与用户关系"+BaseMsg.MODULAR_ADD)
    @Log(detail = "资源与用户关系"+BaseMsg.MODULAR_ADD,operationType = OperationType.INSERT)
    @UserMenuUpdateRedis(permission = true)
    public ResultMsg addSystemPerUser(String ids, String userId) throws Exception{
        return systemPerUserConfigServicesImpl.addPerUser(ids,userId);
    }


     /**
     * 删除
     * @param ids
     * @return 成功失败
     * @throws Exception
     */
     @PostMapping(value = "/delById")
     @ApiOperation(value = "资源与用户关系"+BaseMsg.MODULAR_DEL,notes ="资源与用户关系"+BaseMsg.MODULAR_DEL)
     @Log(detail ="资源与用户关系"+BaseMsg.MODULAR_DEL,operationType = OperationType.DELETE)
     @UserMenuUpdateRedis(permission = true)
     public ResultMsg delSystemPerUserById(String ids, String userId) throws Exception{
         return systemPerUserConfigServicesImpl.delPerUser(ids,userId);
     }

}